<!doctype html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>多媒体信息增加</title>
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/static/css/resource.css" rel="stylesheet" type="text/css" />
    <script src="/static/js/common/common.js" type="text/javascript"></script>
    <link href="/webjars/miniui/css/demo.css" rel="stylesheet" type="text/css" />
    <link href="/static/css/default.css" rel="stylesheet" type="text/css" />
    <style>
        .discell {
            text-align:right;
            width:100px;
        }
        .input {
            width:150px;
        }
    </style>
</head>
<body>
<div class="mini-fit" style="margin-bottom: 40px;">
    <div style="height:100%;width: 100%;overflow-x: auto;overflow-y: auto;">
        <div style="text-align: center"><font color="red">文件上传大小最大为20MB<br>
                请选择.bmp .jpg .png .jpeg 格式文件上传！</font></div>
        <form id="form1" method="post" style="margin-left: 40px;">
            <input name="id" id="id" class="mini-hidden" style="width: 100%" readonly />
            <input name="priNum" id="priNum" class="mini-hidden" style="width: 100%" readonly />
            <br>
            <table align="center" cellspacing="8">
                <tr>
                    <td style="font-weight: bold" class="discell">头像:</td>
                    <td class="input">
                        <input type="button" id="txbtn" value="上传头像" onclick="onFileUpload('hs')">
                    </td>
                    <td style="font-weight: bold" class="discell">指纹:</td>
                    <td class="input">
                        <input type="button" id="zwbtn" value="上传指纹" onclick="onFileUpload('fg')">
                    </td>
                </tr>
            </table>
        </form>
        <div id="showimg" class="mini-fit">
            <div style="height:100%;width: 100%;overflow-x: auto;overflow-y: auto;text-align: center;">
                <div style="display: inline-block;margin-right: 150px;">
                    <#if headList ?? && (headList?size &gt; 0) >
                        <#list headList >
                            <#items as headJpeg>

                                <span style="display: inline-block;width: 155px;padding: 5px;">
                                <img src="/azbj/bjdxInfo/hjqc/toViewTabs/view/readPartImage?url=${headJpeg.path!''}"
                                     alt="头像" width="150" height="150" style="border: 1px solid #dfdfdf;display: inline-block;" />
                                <div style="width: 150px;text-align: center;">上传时间:${headJpeg.uploadDate!''}</div>
                            </span>
                            </#items>
                        </#list>
                    </#if>
                </div>
                <div style="display: inline-block;">
                    <#if fingerList ?? && (fingerList?size &gt; 0) >
                        <#list fingerList >
                            <#items as FingerJpeg>
                                <span style="display: inline-block;width: 160px;padding: 5px;">
                             <img src="/azbj/bjdxInfo/hjqc/toViewTabs/view/readPartImage?url=${FingerJpeg.path!''}"
                                  alt="指纹" width="150" height="150" style="border: 1px solid #dfdfdf;display: inline-block;" />
                             <div style="width: 150px;text-align: center;">上传时间:${FingerJpeg.uploadDate!''}</div>
                        </span>
                            </#items>
                        </#list>
                    </#if>
                </div>
            </div>
        </div>
    </div>
</div>
<div style="position: absolute;bottom: 0;line-height:40px;width: 100%;border-top:1px solid #dfdfdf;text-align: center">
    <a class="mini-button" iconCls="fa-save" plain="true" style="font-size: 15px" onclick="saveData()">保存</a>
</div>

<script type="text/javascript">

    mini.parse();
    var form = new mini.Form("form1");
    var id = mini.get("id");
    var priNum = mini.get("priNum");

    function onFileUpload(e) {
        var pid = priNum.getValue();
        var taskid = "";
        if (e == "hs") {
            taskid = "2";
        } else if (e == "fg") {
            taskid = "3";
        }
        var url = "/upload/user/uploadAppendixfileimg/view?1=1&id=${id!''}&priNum=" + pid + "&taskId=" + taskid;
        commonEdit(url, null, null, 600, 400, true, true, true, function () {
            window.location.reload();
        });
    }

    // 保存数据
    function saveData() {
        form.validate();
        if (form.isValid() == false) {
            return;
        }
        var data = form.getData();
        var json = mini.encode(data);
        var pid = priNum.getValue();
        if (priNum.getValue() == "") {
            mini.alert("请先保存基本信息");
        } else {
            $.ajax({
                url: "/azbj/social/multi/save?prinum=" + pid + "&id=${id!''}",
                data: {data: json},
                type: "post",
                success: function (success) {
                    if (success.code == 1) {
                        mini.alert("保存成功");
                    } else if (success.code == 5599) {
                        mini.alert(success.message);
                    } else {
                        mini.alert("保存失败");
                    }
                }
            });
        }
    }

    window.onload = function () {
        priNum.setValue(${priNum!''});
        if (priNum.getValue() == "") {
            mini.alert("请先保存基本信息");
            $("#txbtn").attr("disabled", "disabled");
            $("#zwbtn").attr("disabled", "disabled");
        } else {
            $("#txbtn").removeAttr("disabled");
            $("#zwbtn").removeAttr("disabled");
        }
    }
</script>
</body>
</html>